﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="recordMessageUI.aspx.cs" Inherits="SampleVoiceForum.recordMessageUI" %>
<%@ Import Namespace="DatabaseLayer" %>

<%
     DatabaseFunctions objectDatabaseFunctions = new DatabaseFunctions();
     objectDatabaseFunctions.addAnalytics((String)Session["sessionId"], (String)Session["callerId"], "recordMessageUI.aspx", "Entered recordMessageUI.aspx", null);
%>

<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.1">
<property name="inputmodes" value="dtmf"/> 
<catch event="connection.disconnect.hangup">
    <submit next="CleanUp.aspx"/>
    <exit/>
</catch>
  <form id="recordMessagePrompt">
    <record name="CallersMessage" beep="true" dtmfterm="true" finalsilence="4s" type="audio/wav" maxtime="1800s">
      <prompt bargein="true" bargeintype="hotword">
        Please record your message after the beep. Press any key to end recording.
      </prompt>
    </record>

      <field name="confirmMessage">
      <prompt bargein="true">
        I heard you say <value expr="CallersMessage"/>. To save this message Press 1. To cancel Press 2.
      </prompt>

      <grammar mode="dtmf" version="1.0" inputmodes="dtmf">
            <rule id="top">
                <one-of>
                    <item>1</item>
                    <item>2</item>
                </one-of>
            </rule>
         </grammar>
         
         <catch event="noinput nomatch">
            <prompt bargein="false">Invalid Input. Please try again.</prompt>
            <reprompt/>
         </catch>

      <filled namelist="confirmMessage" mode="all">
        <if cond="confirmMessage=='1'">
         <submit next="recordMessage.aspx"
              method="post" namelist="CallersMessage" enctype="multipart/form-data"/>
        <else/>
           Recording cancelled. 
          <goto next="home.aspx"/>
        </if>
      </filled>
    </field>
  </form>
</vxml>